import {genTernaryExpression} from "../util";
import { v4 as uuid } from 'uuid';
const genAndItem = () => {
    return {
        type: 'express',
        label: '并且 ',
        key: '&&',
        not: false,
        // express: genTernaryExpression(),
        rows: [
            {
                type: 'and',
                label: '并且 ',
                key: '&&',
                not: false,
                uuid:uuid(),
                express: genTernaryExpression(),
                rows: []
            }
        ]
    }
}

const genExpress = () => {
    return {
        type: 'express',
        label: '',
        key: '',
        not: false,
        uuid:uuid(),
        // express: genTernaryExpression(),
        rows: []
    }
}
const genPlusItem = () => {
    return {
        type: 'express',
        label: '加 ',
        key: '+',
        not: false,
        uuid:uuid(),
        // express: genTernaryExpression(),
        rows: [
            {
                type: 'plus',
                label: '加 ',
                key: '+',
                not: false,
                express: genTernaryExpression(),
                rows: []
            }
        ]
    }
}
const genMinusItem = () => {
    return {
        type: 'express',
        label: '减 ',
        key: '-',
        not: false,
        uuid:uuid(),
        // express: genTernaryExpression(),
        rows: [
            {
                type: 'minus',
                label: '减 ',
                key: '-',
                not: false,
                express: genTernaryExpression(),
                rows: []
            }
        ]
    }
}
const genTimesItem = () => {
    return {
        type: 'express',
        label: '乘',
        key: '*',
        not: false,
        uuid:uuid(),
        // express: genTernaryExpression(),
        rows: [
            {
                type: 'times',
                label: '乘',
                key: '*',
                not: false,
                express: genTernaryExpression(),
                rows: []
            }
        ]
    }
}
const genDividedItem = () => {
    return {
        type: 'express',
        label: '除 ',
        key: '/',
        not: false,
        uuid:uuid(),
        rows: [
            {
                type: 'divided',
                label: '除 ',
                key: '/',
                not: false,
                express: genTernaryExpression(),
                rows: []
            }
        ]
    }
}

const operators={
    // 算数操作符
    arithmeticOperator:[
        {
            key:'minus',
            name:"减",
            value:'-'
        },
        {
            key:'plus',
            name:"加",
            value:'+'
        },
        {
            key:'times',
            name:"乘",
            value:'*'
        },
        {
            key:'divided',
            name:"除",
            value:'/'
        }
    ]
}

const Constants = {
    genPlusItem: genPlusItem,
    genMinusItem: genMinusItem,
    genTimesItem: genTimesItem,
    genDividedItem: genDividedItem,
    genExpress: genExpress,
    genAndItem: genAndItem,
    operators:operators,
    uuid:uuid
}

export default Constants;
